package com.itheima.chapter03.characterstring;

import java.util.Scanner;

/*
    用户登录  usename.equals(name)比较字符串内容
 */
public class domestring3 {
    public static void main(String[] args) {
        String usename = "admin";
        String password="123456";
        Scanner sc=new Scanner(System.in);
        for (int i = 0; i <3 ; i++) {
            System.out.println("请输入用户名：");
            String name=sc.nextLine();
            System.out.println("请输入密码：");
            String psd=sc.nextLine();
            if(usename.equals(name) && password.equals(psd)){
                System.out.println("登陆成功!");
            }else {
                if(i==2){
                    System.out.println("今日您的登录次数已用尽，请明天再来!");
                }else{
                    System.out.println("登录失败！您还剩余"+(2-i)+"次机会");
                }
            }
        }
    }
}
